package com.lazy.controller;

import com.lazy.entity.Bicycle;
import com.lazy.entity.BicycleType;
import com.lazy.service.BicycleService;
import com.lazy.utils.RespBean;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("bicycle")
public class BicycleController {
    @Resource
    private BicycleService bicycleService;

    @GetMapping("/{pageCurrent}/{pageSize}")
    public RespBean PageBicycle(@PathVariable Integer pageCurrent,@PathVariable Integer pageSize){
        return bicycleService.PageBicycle(pageCurrent,pageSize);
    }

    @DeleteMapping("/{id}")
    public RespBean deleteBicycle(@PathVariable Integer id) {
        return bicycleService.deleteBicycle(id);
    }

    @PutMapping("/")
    public RespBean upBicycle(@RequestBody Bicycle bicycle) {
        return bicycleService.upBicycle(bicycle);
    }

    @PostMapping("/")
    public RespBean addBicycle(@RequestBody Bicycle Bicycle){
        return bicycleService.addBicycle(Bicycle);
    }
}

